cmake_minimum_required(VERSION 3.15)
set (CMAKE_CXX_STANDARD 17)
project(shape_based_matching)

# warning C4819: 该文件包含不能在当前代码页(936)中表示的字符。请将该文件保存为 Unicode 格式以防止数据丢失
add_compile_options(/wd4819 /wd4244)
# 以下指令可以免于在每个Cpp文件中都必须加入 #pragma utf-8的指令
add_compile_options(/execution-charset:utf-8)

# debug or release
#SET(CMAKE_BUILD_TYPE "Release")
# find openmp
find_package(OpenMP REQUIRED)

# arm or x86
IF(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
    SET(PLATFORM_COMPILE_FLAGS "-mfpu=neon")
ELSE()
#    SET(PLATFORM_COMPILE_FLAGS "-march=native")

    # some places of the algorithm are designed for 128 SIMD
    # so 128 SSE may slightly faster than 256 AVX, you may want this
    SET(PLATFORM_COMPILE_FLAGS "-msse -msse2 -msse3 -msse4 -mssse3")  # SSE only
ENDIF()

# SET(PLATFORM_COMPILE_FLAGS "-DMIPP_NO_INTRINSICS")  # close SIMD
#SET(CMAKE_CXX_FLAGS "${PLATFORM_COMPILE_FLAGS} $ENV{CXXFLAGS}")

# opencv
# set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /opt/ros/kinetic)
# set(OpenCV_DIR d:/MyProjects/ist-f7000/third/opencv470)
find_package(OpenCV 4 REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

# include MIPP headers
include_directories (${INCLUDE_DIRECTORIES} "${CMAKE_CURRENT_SOURCE_DIR}/MIPP/")


# test exe
add_executable(${PROJECT_NAME} line2Dup.cpp test.cpp)
target_link_libraries(${PROJECT_NAME} ${OpenCV_LIBS})
# OpenMP
target_compile_options(${PROJECT_NAME} PRIVATE ${OpenMP_CXX_FLAGS})
